package com.cesare.mapper;

import com.cesare.pojo.Blog;
import com.cesare.vo.BlogQuery;
import com.cesare.vo.SearchBlog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Mapper
public interface BlogMapper {

    public List<Blog> getAllBlog();

    public void addBlog(Blog blog);

    public void updateBlog(Blog blog);

    public Blog getBlogById(@Param("id") Long id);

    public void deleteBlog(@Param("id") Long id);

    public List<Blog> searchBlog(Blog blog);

    public List<BlogQuery> searchByTitleOrTypeOrRecommend(SearchBlog searchBlog);

    public List<Blog> getBlogByTypeId(@Param("typeId") Long id);

    public List<Blog> getBlogByTagId(@Param("tagId") Long id);

    public List<Blog> getIndexBlog();

    public List<Blog> getRecommendBlog();

    public Blog getDetailedBlog(Long id);

    public void updateViews(Long id);

    public List<Blog> searchIndexBlog(String query);

    public Integer countBlog();

    public List<String> findGroupYear();

    public List<Blog> findByYear(@Param("year")String year);
}
